Feat: add query client for stamp status invalidation#150
Feat: add query client for stamp status invalidation#150skyblue1232 merged 2 commits intodevelopfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughReact Query의 Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI (스탬프 버튼)
participant Page as [placeId].tsx
participant API as Stamp API
participant QClient as React Query Client
UI->>Page: 스탬프 요청
Page->>API: acquireStamp POST { lat: <fixed>, lng: <fixed>, ... }
alt 성공
API-->>Page: 200 OK
Page->>QClient: invalidateQueries('stampStatus')
Page-->>UI: 성공 상태 표시 / 새 데이터 반영
else 오류
API-->>Page: 에러
Page-->>UI: 에러 처리(로그인/알림)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/pages/main/node/[placeId].tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message. |
|
🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/main/node/[placeId].tsx (1)
1-1: Pages Router에서 'use client' 지시문을 제거하세요.이 프로젝트는 Next.js Pages Router를 사용하므로
'use client'지시문이 필요하지 않습니다. 이 지시문은 App Router 전용이며, Pages Router의pages/디렉토리에 있는 컴포넌트는 기본적으로 클라이언트 컴포넌트입니다.Based on learnings
다음 diff를 적용하여 제거하세요:
-'use client'; import { useState, useEffect } from 'react';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/main/node/[placeId].tsx(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-31T17:34:04.352Z
Learnt from: jjangminii
Repo: geulDa/FE PR: 64
File: src/pages/map/result/components/ResultMap.tsx:3-3
Timestamp: 2025-10-31T17:34:04.352Z
Learning: The geulDa/FE project uses Next.js Pages Router (not App Router), so components should import useRouter from 'next/router' and should not use the 'use client' directive.
Applied to files:
src/pages/main/node/[placeId].tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-deploy
🔇 Additional comments (1)
src/pages/main/node/[placeId].tsx (1)
19-19: 캐시 무효화 로직이 올바르게 구현되었습니다.React Query의
useQueryClient를 사용하여 스탬프 획득 성공 후stampStatus쿼리를 무효화하는 패턴이 정확합니다. 이를 통해 UI가 최신 스탬프 상태를 반영할 수 있습니다.Also applies to: 71-71, 95-95
| getLocation( | ||
| (pos) => { | ||
| const body = { | ||
| latitude: 37.52146604044732, | ||
| latitude: 37.52146604044732, | ||
| longitude: 126.76740151260397, | ||
| // 실제 위치 사용 시: | ||
| // latitude: pos.coords.latitude, | ||
| // longitude: pos.coords.longitude, | ||
| }; |
There was a problem hiding this comment.
하드코딩된 좌표로 인해 위치 기반 검증이 우회됩니다.
getLocation()을 호출하여 사용자의 실제 위치를 받아오지만, 받은 pos 파라미터를 사용하지 않고 하드코딩된 좌표를 전송하고 있습니다. 이로 인해:
- 위치 기반 스탬프 획득 검증이 완전히 무력화됩니다
- 사용자에게 불필요하게 위치 권한을 요청합니다
- 테스트/디버그 코드가 프로덕션에 머지될 위험이 있습니다
이것이 의도된 테스트 코드인지 확인이 필요합니다. 프로덕션에 배포할 경우, 실제 사용자 위치를 사용하도록 수정해야 합니다:
const body = {
- latitude: 37.52146604044732,
- longitude: 126.76740151260397,
+ latitude: pos.coords.latitude,
+ longitude: pos.coords.longitude,
};또는 테스트 목적이라면, 별도의 feature flag나 환경 변수로 분리하는 것을 권장합니다.
🤖 Prompt for AI Agents
In src/pages/main/node/[placeId].tsx around lines 81 to 86, the callback to
getLocation ignores the received pos and sends hardcoded coordinates which
bypasses location-based validation; replace the hardcoded latitude/longitude
with the actual pos values (e.g., pos.coords.latitude and pos.coords.longitude)
so the app uses the user’s real location, and if those literal coordinates were
left for testing wrap the behavior behind a feature flag or environment variable
(or remove before prod); confirm intent and ensure location-permission flow and
error handling remain correct when using pos.
🔥 작업 내용
🤔 추후 작업 사항
🔗 이슈
PR Point (To Reviewer)
📸 피그마 스크린샷 or 기능 GIF
(작업 내역 스크린샷)
Summary by CodeRabbit
릴리스 노트